home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version='1.0' encoding='iso-8859-1' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <!-- The parameter below will contain the preferred language translation requested. Note that it is set to "fr" for French, but can be changed to "es" for spanish or "en" for english in this demo". Also note that since it is a top-level parameter, it is possible to change it dynamically by passing the value of the parameter to the stylesheet. --> <xsl:param name="isolang" select="'fr'"/> <xsl:variable name="translations" select="document('allheadings.xml')" /> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <xsl:for-each select="employees/employee"> <xsl:for-each select="*"> <xsl:variable name="fieldname" select="name(.)"/> <!-- Look up header using the current element name --> <xsl:variable name="fieldheader" select="$translations/allheadings/headings[lang($isolang)]/heading[@category=$fieldname]"/> <xsl:value-of select="$fieldheader"/> <xsl:element name="input"> <!-- Set the Size of the textbox --> <xsl:attribute name="size"> <xsl:value-of select="@size"/> </xsl:attribute> <!-- Set the value of the text box --> <xsl:attribute name="value"> <xsl:value-of select="text()"/> </xsl:attribute> <br/> </xsl:element> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>